$(document).ready(function(){
	$('#navHead').empty();
	$('#body').empty();
	$('#navHead').append('<table class="table" style="margin-bottom: -20px;"><tr><td align="center"width="80%"><span align="center"><font color="#fff"size="4"align="center"id="heading"style="padding-left:20%">个人及话题介绍</font></span></td><td align="right"width="20%"><font color="#fff"size="3"align="center"id="baocun">下一步</font></td></tr></table>');
	$('#body').append('<div class="panel panel-defalut"><div class="panel-heading"style="padding-top: 10px;background-color: #f5f5f5;"align="center">&nbsp;</div><div id="default"class="container"></div><div class="panel-heading"style="padding-top: 30px;background-color: #f5f5f5;"align="center">&nbsp;</div></div>');
	$.post('http://liveser.cn/new/benew/get/state1',
        {
          data : 1
        },
        function(data,status)
        {
          json1=eval("("+data+")");
          for(var i =0;i<json1.length;i++)
          {
            //alert(json1[i].heading);
            $('#default').append('<a href="#" role="button" onclick="a_leading('+json1[i].auto_id+')"><div class="jumbotron"> <h1>'+json1[i].heading+'</h1><p>'+json1[i].intro+'</p><p><span class="btn btn-primary btn-lg" role="button">详情</span></p></div></a>')
          }
          $('#default').append('<div class="jumbotron" id="add_topic" onclick="add_topic()"><h1>+</h1></div>');
		  $('#default').append('<div class="jumbotron" id="introduction" onclick="edit_intro()" ><h1>个人介绍</h1></div>');
        });
	
});


		
		
function a_leading(id)
{
	
	$.post('http://liveser.cn/new/benew/set/topic_id',
	{
		id: id
	},
	function(data,status)
	{
			if(data == '1')
			{
				jQuery.ajax({
				url: "http://liveser.cn/js/new_benew_topic.js",
				dataType: "script",
				cache: true
			}).done(function() {
				jQuery.cookie("new_benew_topic", "value", {
					expires: 0
				});
			});
		}
		else
		{
			alert('gg');
		}
	});
}

function add_topic()
{
	jQuery.ajax({
		url: "http://liveser.cn/js/new_benew_topic_add.js",
		dataType: "script",
		cache: true
	}).done(function() {
		jQuery.cookie("new_benew_topic_add", "value", {
			expires: 0
		});
	});
}

function edit_intro()
{
	jQuery.ajax({
		url: "http://liveser.cn/js/new_benew_edit_intro.js",
		dataType: "script",
		cache: true
	}).done(function() {
		jQuery.cookie("new_benew_edit_intro", "value", {
			expires: 0
		});
	});
}